<template>
    <Navtitle :title="title"></Navtitle>
    <div v-for="item in goodsApiData">
        <router-link :to="{name:'detail',params:{goods_id:item.goods_id}}">
            <van-card :num="item.goods_number" :price="item.goods_price" :title="item.goods_name">
            <template #thumb>
                <lazy-component>
                    <img :src="item.goods_small_logo ? item.goods_small_logo : 'https://fastly.jsdelivr.net/npm/@vant/assets/ipad.jpeg'"
                        alt=""
                        v-lazy="item.goods_small_logo ? item.goods_small_logo : 'https://fastly.jsdelivr.net/npm/@vant/assets/ipad.jpeg'"
                        style="width: 70px;height: 70px;">
                </lazy-component>
            </template>
        </van-card>
        </router-link>
    </div>
</template>

<script setup>
import { goodsApi } from '@/api/api';
import Navtitle from '@/components/Navtitle.vue';
const title = '商品列表'
import { ref } from 'vue';
import { useRoute } from 'vue-router';
let goodsApiData = ref([])
let route = useRoute()
goodsApi(route.params.query).then(res => {
    goodsApiData.value = res.data.message.goods
})
</script>

<style lang="scss" scoped></style>